home *** CD-ROM | disk | FTP | other *** search
Wrap
property getPDLError, myBehaviorName, myDistantMovie, myDistantMarker, myJumpMode, myReturn, myTurnOffAllSounds on beginSprite me Initialize(me) end on mouseUp me jump(me) end on Initialize me global gNavigationButtonList myBehaviorName = string(me) delete word 1 of myBehaviorName delete char -30001 of myBehaviorName delete char -30001 of myBehaviorName if myReturn then if voidp(gNavigationButtonList) then gNavigationButtonList = [#stack: [], #forward: [], #index: []] else if gNavigationButtonList.ilk <> #propList then ErrorAlert(me, #invalidGlobal, gNavigationButtonList) else if not gNavigationButtonList.findPos(#stack) then ErrorAlert(me, #invalidGlobal, gNavigationButtonList) else if not gNavigationButtonList.findPos(#index) then ErrorAlert(me, #invalidGlobal, gNavigationButtonList) else if not gNavigationButtonList.findPos(#forward) then ErrorAlert(me, #invalidGlobal, gNavigationButtonList) end if end if end if end if end if end if case myDistantMarker of EMPTY, " ": myDistantMarker = 0 end case end on jump me global gNavigationButtonList if myTurnOffAllSounds then sound(1).stop() sound(2).stop() sound(3).stop() sound(4).stop() sound(5).stop() sound(6).stop() end if currentMarker = [#frame: marker(0), #movie: the movieName] if myReturn then gNavigationButtonList.stack.append(currentMarker) if not gNavigationButtonList.index.getPos(currentMarker) then gNavigationButtonList.index.append(currentMarker) end if gNavigationButtonList.forward = [] end if if myJumpMode = "Go to" then go(marker(myDistantMarker), myDistantMovie) else play frame marker(myDistantMarker) of movie myDistantMovie end if if the movieName = myDistantMovie then if the frameLabel <> myDistantMarker then ErrorAlert(me, #invalidMarker, currentMarker) end if end if end on substituteStrings me, parentString, childStringList i = childStringList.count() repeat while i tempString = EMPTY dummyString = childStringList.getPropAt(i) replacement = childStringList[i] lengthAdjust = dummyString.char.count - 1 repeat while 1 position = offset(dummyString, parentString) if not position then parentString = tempString & parentString exit repeat next repeat end if if position <> 1 then tempString = tempString & parentString.char[1..position - 1] end if tempString = tempString & replacement delete parentString.char[1..position + lengthAdjust] end repeat i = i - 1 end repeat return parentString end on ErrorAlert me, theError, Data behaviorName = string(me) delete word 1 of behaviorName delete char -30001 of behaviorName delete char -30001 of behaviorName case Data.ilk of #void: Data = "<void>" #symbol: Data = "#" & Data end case case theError of #getPDL_Invalid: terror1 = "BEHAVIOR ERROR: Frame ^0, Sprite ^1" terror1 = substituteStrings(me, terror1, ["^0": the frame, "^1": the currentSpriteNum]) terror2 = "Parameters for behavior ^0 have not been correctly set. " & "Select a valid movie name in the Behavior Parameters dialog." terror2 = substituteStrings(me, terror2, ["^0": myBehaviorName]) terror3 = "Current movie = ^0" terror3 = substituteStrings(me, terror3, ["^0": Data]) alert(terror1 & RETURN & RETURN & terror2 & RETURN & RETURN & terror3) halt() #invalidGlobal: terror1 = "BEHAVIOR ERROR: Frame ^0, Sprite ^1" terror1 = substituteStrings(me, terror1, ["^0": the frame, "^1": the currentSpriteNum]) terror2 = "Behavior ^0 requires a global gNavigationButtonList with the following" & RETURN & " structure:" terror2 = substituteStrings(me, terror2, ["^0": myBehaviorName]) terror3 = "[#stack [...], #index: [...], #forward: [...]]" tError4 = "Current value = ^0" tError4 = substituteStrings(me, tError4, ["^0": Data]) alert(terror1 & RETURN & RETURN & terror2 & RETURN & RETURN & terror3 & RETURN & RETURN & tError4) abort() #invalidMarker: if the runMode = "Author" then terror1 = "BEHAVIOR ERROR: ^0, Sprite ^1" terror1 = substituteStrings(me, terror1, ["^0": Data, "^1": the currentSpriteNum]) terror2 = "Behavior ^0" terror2 = substituteStrings(me, terror2, ["^0": myBehaviorName]) terror3 = "There is no marker ^0 in movie ^1. " & "Enter a valid marker (see Message Window) in the Behavior Parameters dialog." terror3 = substituteStrings(me, terror3, ["^0": QUOTE & myDistantMarker & QUOTE, "^1": myDistantMovie]) alert(terror1 & RETURN & RETURN & terror2 & RETURN & RETURN & terror3) end if end case end on isOKToAttach me, aSpriteType, aSpriteNum return aSpriteType = #graphic end on getPropertyDescriptionList me if not (the currentSpriteNum) then exit end if return [#myDistantMovie: [#comment: "On mouseUp, go to movie" & RETURN & "(Include path if necessary)", #format: #string, #default: "Type the name of your movie here"], #myDistantMarker: [#comment: "Marker in the other movie (optional)", #format: #string, #default: " "], #myJumpMode: [#comment: "Jump Mode", #format: #string, #range: ["Go to", "Play and Return"], #default: "Go to"], #myReturn: [#comment: "Remember current marker for Back button?", #format: #boolean, #default: 1], #myTurnOffAllSounds: [#comment: "Turn off all sounds before jumping?", #format: #boolean, #default: 1]] end